import java.io.PrintStream;
import java.util.Vector;
import java.util.ListIterator;

public class FlightInfo {

	//Message parsers can expect this number of fields for Main DUTYFREE Info
  public static final int NUM_MANDATORY_FIELDS = 5; 
	
	private int m_Ref = 0;				/* Mandatory */
	private String m_FlightNum;				/* Mandatory */
	
	private Vector<String> m_OffServices;

	public FlightInfo(int ref, String FlightNUMBER){
		m_Ref = ref;
		m_FlightNum = FlightNUMBER;
	
		m_OffServices = new Vector<String>();
	}


	synchronized public String getMainInfoAsDelimString(String delim){
		StringBuilder draftResp = new StringBuilder();
		draftResp.append(m_Ref + delim);
		draftResp.append(m_FlightNum + delim);
		return draftResp.toString();
	}
	
	public int getRef (){
		return m_Ref;
	}
	
	public String getNumber(){
		return m_FlightNum;
	}
	
	
	public Vector<String> getOffServices(){
		return m_OffServices;
	}

  public void addDUTYFREEService(String srvc){
  	m_OffServices.add(srvc);
  }

  synchronized public String getOffServicesDelimString(String delim){
  	StringBuilder draftResp = new StringBuilder();
  	ListIterator<String> iter = m_OffServices.listIterator();
  	
  	while (iter.hasNext())
  		draftResp.append(iter.next() + delim);
  	
  	return draftResp.toString();
  }

	public void printMainInfoToConsole() {
		PrintStream out = System.out;
		
		out.println();
		out.println(m_FlightNum);
		
	
		out.println();
	}
}


